/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sys.dao;

import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import sys.bean.FormaPgtoBean;
import sys.utils.ConexaoADS;

/**
 *
 * @author Cesar Daniel
 */
public class FormaPgtoDao {

    public static List<FormaPgtoBean> getListaFPgto() throws SQLException, IOException {
        List<FormaPgtoBean> listaFPgto = new ArrayList<>();
        Connection con = ConexaoADS.getConection();

        String sql = "SELECT C10CODIGO, C10DESC FROM SPAC10";

        PreparedStatement stmt = con.prepareStatement(sql);
        ResultSet rs = stmt.executeQuery();

        while (rs.next()) {

            FormaPgtoBean sp = new FormaPgtoBean();

            sp.setCodigo(rs.getString("C10CODIGO"));
            sp.setDescricao(rs.getString("C10DESC"));

            listaFPgto.add(sp);
        }
        
        stmt.close();
        con.close();

        return listaFPgto;
    }
}
